﻿<phone:PhoneApplicationPage 
    x:Class="CodeBadger.GasMileage.Views.AddEditPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" 
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="696" d:DesignWidth="480"
    shell:SystemTray.IsVisible="True">

    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsMenuEnabled="False" >
            <shell:ApplicationBar.Buttons>
                <shell:ApplicationBarIconButton IconUri="/Icons/ListIcon.png" 
                                                Text="List" Click="ListClick"/>
                <shell:ApplicationBarIconButton IconUri="/Icons/DeleteIcon.png" 
                                                Text="Delete" Click="DeleteClick"/>                
            </shell:ApplicationBar.Buttons>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="24,24,0,12">
            <TextBlock x:Name="ApplicationTitle" Text="GAS MILEAGE" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="PageTitle" Text="add" Margin="-3,-8,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <Grid x:Name="ContentGrid" Grid.Row="1">
        	<ScrollViewer Margin="0,20,0,0" DataContext="{Binding Entry}">
        	<StackPanel Orientation="Vertical">
                
        		<TextBlock Text="Date" Margin="20,0" />
                <toolkit:DatePicker Margin="10,0" Value="{Binding Date, Mode=TwoWay}" />

        		<TextBlock Text="Miles since last fill-up" Margin="20,10,20,0" />
        		<TextBox x:Name="MileageTextBox" Margin="10,0" InputScope="Number" 
                         Text="{Binding Mileage, Mode=TwoWay, Converter={StaticResource NoZerosConverter}}"
                         KeyUp="MileageTextBoxKeyUp"
                         MaxLength="8" />

        		<TextBlock Text="Gallons in" Margin="20,10,20,0" />
        		<TextBox x:Name="GallonsTextBox" Margin="10,0" InputScope="Number"
                         Text="{Binding Gallons, Mode=TwoWay, Converter={StaticResource NoZerosConverter}}"
                         KeyUp="GallonsTextBoxKeyUp"
                         MaxLength="6" />

                <TextBlock Text="Price" Margin="20,10,20,0" />
                <TextBox x:Name="PriceTextBox" Margin="10,0" InputScope="Number"
                        Text="{Binding Price, Mode=TwoWay, Converter={StaticResource NoZerosConverter}}"
                        KeyUp="PriceTextBoxKeyUp"
                        MaxLength="6" />

                <Button x:Name="DoneButton" 
        		        Content="done" 
        		        HorizontalAlignment="Right" 
        		        Margin="0,20,10,0" Click="DoneButtonClick" />

        	</StackPanel>
        	</ScrollViewer>
        </Grid>
    </Grid>

</phone:PhoneApplicationPage>
